<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="renderer" content="webkit">
    <link rel="stylesheet" href="/mdui/css/mdui.min.css">
    <script defer src="/mdui/js/mdui.min.js"></script>
    <script src="/js/axios.min.js"></script>
    <script src="/js/qs.min.js"></script>
    <script src="/js/common.js"></script>
    <script src="/js/vue.js"></script>

    <style>
        .mdui-table-fluid {
            width: 1200px;
        }

        .mdui-table {
            border: 1px solid #d6d6d6;
        }

        .mdui-btn {
            margin-right: 100px;
        }

        a {
            text-decoration: none;
        }

        .mdui-table-fluid {
            width: 800px;
        }

        .mdui-table td img {
            height: 100px;
            width: 140px;
        }

        .mdui-textfield-input1 {
            border: 0;
            height: 50px;
            width: 350px;
            outline: none;
        }

        .sure {
            width: 100px;
            margin: auto;
        !important;
        }

        .mdui-btn-dense {
            margin-top: 10px;
            width: 500px;
            height: 40px;
            margin-left: 100px;
        }

    </style>
</head>
<div id="app">
    <h3>报修单编号{{repair.id}}</h3>
    <div class="mdui-table-fluid">

        <table class="mdui-table">
            <thead>
            <tr>
                <th>特征</th>
                <th>描述</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td>地点</td>
                <td><input class=" mdui-textfield-input1" type="text" v-model="repair.place" name="detail"/></td>
            </tr>
            <tr>
                <td>时间</td>
                <td><input class=" mdui-textfield-input1" type="text" v-model="repair.submitTime"
                           readonly name="detail"/></td>
            </tr>
            <tr>
                <td>详情</td>
                <td><input class=" mdui-textfield-input1" type="" v-model="repair.detail" name="detail"/>
                </td>
            </tr>
            <tr>
                <td>图片</td>
                <td class="img-hight"><img :src="'/repair/downlode/' + repair.id">
                </td>
            </tr>
            </tbody>
        </table>
    </div>
    <button class="mdui-btn mdui-btn-dense mdui-color-theme-accent mdui-ripple mdui-color-green-800"
            @click="uplodeRepair">
        确定修改
    </button>
</div>

<script>
    let params = new URLSearchParams(location.search);//location.searc url中参数的部分包括问号
    let repairid = params.get("id")
    new Vue({
        el: '#app',
        data: {
            repair: {
                id: '',
                status: "",
                detail: "",
                place: "",
                picMD5: "",
                submitTime: ""
            },
        },
        created() {
            let _this = this
            axios.get("/repair/findById?id=" + repairid)
                .then(function (res) {
                    _this.repair = res.data;

                })
        },
        filters: {
            fmtGenter(val) {
                if (val == 1) {
                    return "未安排维修维修"
                } else if (val == 2) {
                    return "已安排检修"
                } else if (val == 3) {
                    return "待同意取消，"
                } else if (val == 4) {
                    return "已同意取消"
                } else if (val == 5) {
                    return "待验收"
                } else if (val == 5) {
                    return "已验收"
                }
            }
        },
        methods: {
            uplodeRepair() {
                console.log(123)
                if (this.repair.detail == "" || this.repair.place == "") {
                    mdui.alert("内容不能为空")
                    return;
                }
                console.log(this.repair)
                let _this = this;
                axios.post("/repair/updateRepair", this.repair)
                    .then(function (res) {
                        if (res.data.success) {
                            mdui.alert("修改成功");
                        }
                    })
                window.location.href = "detail.html?id=" + repairid;
            },
            saveuser() {
                if (this.repair.name == "") {
                    mdui.alert("请输入姓名")
                    return;
                }
                console.log(this.user)
                let _this = this;

                axios.post("/user/saveUser", this.user)

                    .then(function (res) {
                        if (res.data.success) {
                            mdui.alert("修改成功");
                        }
                    })
            },
        }
    })

</script>
</body>
</html>